const path = require("path");
const TerserJSPlugin = require("terser-webpack-plugin");
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");
const smp = new SpeedMeasurePlugin();
const {merge} = require("webpack-merge");
const baseConfig = require("./base");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
  .BundleAnalyzerPlugin;


const config = merge(baseConfig, {
  mode: "production",
  optimization: {
    minimize:true,
    minimizer: [
      new TerserJSPlugin({
        cache: true,
        parallel: true,
      }), 
      new OptimizeCSSAssetsPlugin({}),
    ]
  },
  plugins: [
    // new BundleAnalyzerPlugin({
    //   openAnalyzer:false
    // }),
  ],
});

module.exports = smp.wrap(config);

